import os;
from ConfigParser import ConfigParser

class ConfigHelper:
    """A helper class helps to read or write web configuration file.
    """
    
    instance = None;

    def __init__(self):
        self.instance = ConfigParser();
        configFileName = self.get_config_file_name();
        
        self.instance.read(configFileName);
    
    def get_instance(self):
        """Returns the single instance of class ConfigParser.
        """
        
        return self.instance;
            
    def get_config_file_name(self):
        """Returns the absolute configuration file name.
        """
        dirName = os.path.dirname(__file__);
        configFileName = dirName + "/web.conf";
        
        return configFileName;
    
class ConfigSections:
    """Defines the section names in web.config file
    """
    database = "database";
    
    auth = "auth";


class ConfigKeys:
    """Defines the key names in web.config file
    """
    # Section: database
    host = "host";
    user = "user";
    password = "password";
    database = "database";
    
    # Section: auth
    user = "user";
    encrypted_password = "encrypted_password";